<template>
	<div>
		<el-tag v-if="isCheck(1)" size="mini" class="select-tag" @click="change(1)">组织</el-tag>
		<el-tag v-if="isCheck(2)" size="mini" class="select-tag" @click="change(2)">用户</el-tag>
		<el-tag v-if="isCheck(4)" size="mini" class="select-tag" @click="change(4)">供应商</el-tag>
		<el-tag v-if="isCheck(8)" size="mini" class="select-tag" @click="change(8)">分类</el-tag>
		<item-config ref="itemConfig" :type="currentType" :priceId="priceId" :orgId="orgId"></item-config>
	</div>
</template>

<script>
	import itemConfig from "./itemConfig.vue"
	export default {
		name: "pointType",
		components: {
			itemConfig
		},
		data() {
			return {
				currentType: 0
			}
		},
		props: {
			type: {
				type: Number,
				default: 0
			},
			priceId: {
				type: String,
				default: ""
			},
			orgId: {
				type: String,
				default: ""
			}
		},
		methods: {
			isCheck(type) {
				return (this.type & type) == type
			},
			change(type) {
				this.currentType = type
				this.$nextTick(() => {
					this.$refs['itemConfig'].init()
				})
			}
		}
	}
</script>

<style scoped>
	.select-tag {
		margin-right: 5px;
	}
</style>
